package com.web.service.impl;

import com.web.dao.UserDAO;
import com.web.entity.User;
import com.web.util.JDBCUtil;

import java.util.List;

import static com.web.util.JDBCUtil.query;

public class UserDAOImpl implements UserDAO {

    @Override
    public User selectUserByUsername(String username) {
        List<User> users = JDBCUtil.query(User.class, "select * from user where username = ?", username);
        if (users.size() > 0) {
            return users.get(0);
        }
        return null;
    }
}
